/*
============================================================================
Name        : SBNinePatchView.h
Author      : LJin
Version     :
Copyright   : This is LJin's Program
Description : Application view
============================================================================
*/

#ifndef __SBNINEPatchAPPVIEW_H__
#define __SBNINEPatchAPPVIEW_H__

// INCLUDES
#include <coecntrl.h>
#include <bitdev.h>
#include <gdi.h> 

// CLASS DECLARATION
class CSBNinePatchAppView : public CCoeControl
{
public:  // New methods

	/**
	* NewL.
	* Two-phased constructor.
	* Create a CSBNinePatchAppView object, which will draw itself to aRect.
	* @param aRect The rectangle this view will be drawn to.
	* @return a pointer to the created instance of CSBNinePatchAppView.
	*/
	static CSBNinePatchAppView* NewL( const TRect& aRect );

	/**
	* NewLC.
	* Two-phased constructor.
	* Create a CSBNinePatchAppView object, which will draw itself
	* to aRect.
	* @param aRect Rectangle this view will be drawn to.
	* @return A pointer to the created instance of CSBNinePatchAppView.
	*/
	static CSBNinePatchAppView* NewLC( const TRect& aRect );

	/**
	* ~CSBNinePatchAppView
	* Virtual Destructor.
	*/
	virtual ~CSBNinePatchAppView();

public:   // Functions from base classes

	/**
	* From CCoeControl, Draw
	* Draw this CSBNinePatchAppView to the screen.
	* @param aRect the rectangle of this view that needs updating
	*/
	void Draw( const TRect& aRect ) const;

	/**
	* From CoeControl, SizeChanged.
	* Called by framework when the view size is changed.
	*/
	virtual void SizeChanged();

	TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,TEventCode aType );
	
	void HandlePointerEventL(const TPointerEvent& aPointerEvent);
	
	bool iIsNew;

private:  // Constructors

	/**
	* ConstructL
	* 2nd phase constructor.
	* Perform the second phase construction of a
	* CSBNinePatchAppView object.
	* @param aRect The rectangle this view will be drawn to.
	*/
	void ConstructL(const TRect& aRect);

	/**
	* CSBNinePatchAppView.
	* C++ default constructor.
	*/
	CSBNinePatchAppView();
	


	CWsBitmap* iBitmap;
	CFbsBitmapDevice* iDevice;
	CFbsBitGc* iGc;

	CFbsBitmap* iSrcBitmap;
	CFbsBitmap* iTT;
	
	CFbsBitmap* iBg;

	TPoint iLastPoint;
	

public:  //  Periodic
	CPeriodic* iPeriodic;
	void OnPeriodic();
	TBool iIsStoped;
	static TInt PeriodicCall(TAny* aObj);

};

#endif // __SBNINEPatchAPPVIEW_H__

// End of File
